package com.tiger.cloud.controller.crm;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tiger.cloud.filter.CurrentUserId;
import com.tiger.cloud.filter.IgnoreAuth;
import com.tiger.cloud.service.crm.CommonPointRule;
import com.tiger.cloud.service.system.CommonDict;
import com.tiger.cloud.service.system.CommonRegions;
import com.tiger.cloud.util.Response;
import com.tiger.cloud.util.ResponseUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@Controller
@RequestMapping("cache")
@Api(value = "缓存操作接口",tags = "缓存")
public class CommonController{
	
	/**
	 * 重新加载(缓存)积分角色
	 */
	@RequestMapping(value = "reLoadPointRule", method = RequestMethod.GET)
	@ResponseBody
	@IgnoreAuth
	@CrossOrigin
	@ApiOperation(value = "重新加载(缓存)积分角色",notes = "重新加载(缓存)积分角色")
	public Response reLoadPointRule(@ApiParam(name="id",value="用户id",hidden=true) @CurrentUserId Long userId){
		CommonPointRule.init();
		return ResponseUtil.ok();
	}
	
	
	/**
	 * 重新加载数据(缓存)字典
	 */
	@RequestMapping(value = "reloadDict", method = RequestMethod.GET)
	@ResponseBody
	@IgnoreAuth
	@CrossOrigin
	@ApiOperation(value = "重新加载数据(缓存)字典",notes = "重新加载数据(缓存)字典")
	public Response reLoadDict(@ApiParam(name="id",value="用户id",hidden=true) @CurrentUserId Long userId){
		CommonDict.init();
		return ResponseUtil.ok();
	}
	
	/**
	 * 重新加载数据(缓存)省/市/区
	 */
	@RequestMapping(value = "reloadRegions", method = RequestMethod.GET)
	@ResponseBody
	@IgnoreAuth
	@CrossOrigin
	@ApiOperation(value = "重新加载数据(缓存)省/市/区",notes = "重新加载数据(缓存)字典省/市/区")
	public Response reLoadRegions(@ApiParam(name="id",value="用户id",hidden=true) @CurrentUserId Long userId){
		CommonRegions.init();
		return ResponseUtil.ok();
	}

	
}
